/**
 * 主页js
 */


if(location.href=="http://jyt.jl.gov.cn/" || location.href=="http://jyt.jl.gov.cn/index.html"){

//第一部分
	
	//各个选项名称对应的内容数量
	 _EsdDynamicTransformationScript.num4 = $(".top .margin-left .tab-bd .tab-pal:eq(0) ul li").length-1;
	 _EsdDynamicTransformationScript.num5 = $(".top .margin-left .tab-bd .tab-pal:eq(1) ul li").length-1;
	 _EsdDynamicTransformationScript.num6 = $(".top .margin-left .tab-bd .tab-pal:eq(2) ul li").length-1;
	 _EsdDynamicTransformationScript.num7 = $(".top .margin-left .tab-bd .tab-pal:eq(3) ul li").length-1;
	
	//各个选项名称
	 _EsdDynamicTransformationScript.esd4TagNum1 = $(".top .margin-left .tab-hd ul li a:eq(0)");
	 _EsdDynamicTransformationScript.esd4TagNum2 = $(".top .margin-left .tab-hd ul li a:eq(1)");
	 _EsdDynamicTransformationScript.esd4TagNum3 = $(".top .margin-left .tab-hd ul li a:eq(2)");
	 _EsdDynamicTransformationScript.esd4TagNum4 = $(".top .margin-left .tab-hd ul li a:eq(3)");
	
	//各个选项中的第一个内容
	 _EsdDynamicTransformationScript.esd4TagNum1Content1 = $(".top .margin-left .tab-bd .tab-pal:eq(0) ul li:eq(0) a");
	 _EsdDynamicTransformationScript.esd4TagNum2Content1 = $(".top .margin-left .tab-bd .tab-pal:eq(1) ul li:eq(0) a");
	 _EsdDynamicTransformationScript.esd4TagNum3Content1 = $(".top .margin-left .tab-bd .tab-pal:eq(2) ul li:eq(0) a");
	 _EsdDynamicTransformationScript.esd4TagNum4Content1 = $(".top .margin-left .tab-bd .tab-pal:eq(3) ul li:eq(0) a");
	
	//各个选项中的最后一个内容
	 _EsdDynamicTransformationScript.esd4TagNum1ContentN = $(".top .margin-left .tab-bd .tab-pal:eq(0) ul li:eq("+_EsdDynamicTransformationScript.num4+") a");
	 _EsdDynamicTransformationScript.esd4TagNum2ContentN = $(".top .margin-left .tab-bd .tab-pal:eq(1) ul li:eq("+_EsdDynamicTransformationScript.num5+") a");
	 _EsdDynamicTransformationScript.esd4TagNum3ContentN = $(".top .margin-left .tab-bd .tab-pal:eq(2) ul li:eq("+_EsdDynamicTransformationScript.num6+") a");
	 _EsdDynamicTransformationScript.esd4TagNum4ContentN = $(".top .margin-left .tab-bd .tab-pal:eq(3) ul li:eq("+_EsdDynamicTransformationScript.num7+") a");
	
	//第一块
	_EsdDynamicTransformationScript.esd4TagNum1.focus(function (e) {
		e = $(this).mouseover();
		$(this).bind("keydown.keydown_1", function (e) {
			if(e.shiftKey&&e.keyCode==9){

			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum1Content1.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum1.blur(function () {
		$(this).unbind("keydown.keydown_1");
	});

	_EsdDynamicTransformationScript.esd4TagNum1Content1.focus(function () {
		$(this).bind("keydown.keydown_s1", function (e) {
			if (e.shiftKey && e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum1.focus();
				return false;
			}else if (e.keyCode == 9) {
				$(".top .margin-left .tab-bd .tab-pal:eq(0) ul li:eq(1) a").focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum1Content1.blur(function () {
		$(this).unbind("keydown.keydown_s1");
	});

	_EsdDynamicTransformationScript.esd4TagNum1ContentN.focus(function () {
		$(this).bind("keydown.keydown_e1", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				$(".top .margin-left .tab-bd .tab-pal:eq(0) ul li:eq(5) a").focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum2.mouseover();
				_EsdDynamicTransformationScript.esd4TagNum2.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum1ContentN.blur(function () {
		$(this).unbind("keydown.keydown_e1");
	});
	
	//第二块
	_EsdDynamicTransformationScript.esd4TagNum2.focus(function (e) {
		$(this).bind("keydown.keydown_2", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				_EsdDynamicTransformationScript.esd4TagNum1.mouseover();
				_EsdDynamicTransformationScript.esd4TagNum1ContentN.focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum2Content1.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum2.blur(function () {
		$(this).unbind("keydown.keydown_2");
	});

	_EsdDynamicTransformationScript.esd4TagNum2Content1.focus(function () {
		$(this).bind("keydown.keydown_s2", function (e) {
			if (e.shiftKey && e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum2.focus();
				return false;
			}else if (e.keyCode == 9) {
				$(".top .margin-left .tab-bd .tab-pal:eq(1) ul li:eq(1) a").focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum2Content1.blur(function () {
		$(this).unbind("keydown.keydown_s2");
	});

	_EsdDynamicTransformationScript.esd4TagNum2ContentN.focus(function () {
		$(this).bind("keydown.keydown_e2", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				$(".top .margin-left .tab-bd .tab-pal:eq(1) ul li:eq(5) a").focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum3.mouseover();
				_EsdDynamicTransformationScript.esd4TagNum3.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum2ContentN.blur(function () {
		$(this).unbind("keydown.keydown_e2");
	});
	
	//第三块
	_EsdDynamicTransformationScript.esd4TagNum3.focus(function (e) {
		$(this).bind("keydown.keydown_3", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				_EsdDynamicTransformationScript.esd4TagNum2.mouseover();
				_EsdDynamicTransformationScript.esd4TagNum2ContentN.focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum3Content1.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum3.blur(function () {
		$(this).unbind("keydown.keydown_3");
	});

	_EsdDynamicTransformationScript.esd4TagNum3Content1.focus(function () {
		$(this).bind("keydown.keydown_s3", function (e) {
			if (e.shiftKey && e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum3.focus();
				return false;
			}else if (e.keyCode == 9) {
				$(".top .margin-left .tab-bd .tab-pal:eq(2) ul li:eq(1) a").focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum3Content1.blur(function () {
		$(this).unbind("keydown.keydown_s3");
	});

	_EsdDynamicTransformationScript.esd4TagNum3ContentN.focus(function () {
		$(this).bind("keydown.keydown_e3", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				$(".top .margin-left .tab-bd .tab-pal:eq(2) ul li:eq(5) a").focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum4.mouseover();
				_EsdDynamicTransformationScript.esd4TagNum4.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum3ContentN.blur(function () {
		$(this).unbind("keydown.keydown_e3");
	});
	
	//第四块
	_EsdDynamicTransformationScript.esd4TagNum4.focus(function (e) {
		$(this).bind("keydown.keydown_4", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				_EsdDynamicTransformationScript.esd4TagNum3.mouseover();
				_EsdDynamicTransformationScript.esd4TagNum3ContentN.focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum4Content1.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum4.blur(function () {
		$(this).unbind("keydown.keydown_4");
	});
	
	_EsdDynamicTransformationScript.esd4TagNum4Content1.focus(function () {
		$(this).bind("keydown.keydown_s4", function (e) {
			if (e.shiftKey && e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd4TagNum4.focus();
				return false;
			}else if (e.keyCode == 9) {
				$(".top .margin-left .tab-bd .tab-pal:eq(3) ul li:eq(1) a").focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd4TagNum4Content1.blur(function () {
		$(this).unbind("keydown.keydown_s4");
	});





// 将iframe所包含的a链接数 第一个a元素 最后一个a元素赋值给第一个参数的js对象
_EsdDynamicTransformationScript.getIframeInfos = function(jsObj,iframeObj){
  if(iframeObj != undefined){
   jsObj.aLink_num = iframeObj.contentWindow.document.getElementsByTagName("a").length;
   jsObj.first_aLink = iframeObj.contentWindow.document.getElementsByTagName("a")[0];
   jsObj.last_aLink = iframeObj.contentWindow.document.getElementsByTagName("a")[jsObj.aLink_num-1];
   jsObj.self = iframeObj;
  }
 };


// 声明iframe操作对象
_EsdDynamicTransformationScript.iframe1 = {};
_EsdDynamicTransformationScript.iframe2 = {};

//通过方法赋值
_EsdDynamicTransformationScript.iframeElement1 = document.getElementsByTagName("iframe")[0];   // 需要修改 这里的iframe获取
_EsdDynamicTransformationScript.iframeElement2 = document.getElementsByTagName("iframe")[1];   // 需要修改 这里的iframe获取


//选项卡标签 jquery对象
_EsdDynamicTransformationScript.iframeTab1 = $(".top1 .notice .tab-hd .tab-nav li:eq(1) a");  // 需要修改 这里的tab获取
_EsdDynamicTransformationScript.iframeTab2 = $(".top1 .notice .tab-hd .tab-nav li:eq(2) a");  // 需要修改 这里的tab获取




_EsdDynamicTransformationScript.num10 = $(".top1 .notice .tab-bd .tab-pal:eq(0) ul a").length-1;
_EsdDynamicTransformationScript.esd5TagNum1 = $(".top1 .notice .tab-hd .tab-nav li:eq(0) a");
_EsdDynamicTransformationScript.esd5TagNum1Content1 = $(".top1 .notice .tab-bd .tab-pal:eq(0) ul a:eq(0)");
_EsdDynamicTransformationScript.esd5TagNum1Content2 = $(".top1 .notice .tab-bd .tab-pal:eq(0) ul a:eq(1)");
_EsdDynamicTransformationScript.esd5TagNum1ContentN = $(".top1 .notice .tab-bd .tab-pal:eq(0) ul a:eq("+_EsdDynamicTransformationScript.num10+")");


// 判断iframe是否有效
if((_EsdDynamicTransformationScript.iframeElement1!=undefined) && (_EsdDynamicTransformationScript.iframeElement2!=undefined)){

	// 当iframe都加载完毕后执行代码 使用setInterval
	_EsdDynamicTransformationScript.iframeInterval = setInterval(function(){	
		
		if((_EsdDynamicTransformationScript.iframeElement1.contentWindow.document.getElementsByTagName("a")[0]!=undefined) 
				&& (_EsdDynamicTransformationScript.iframeElement2.contentWindow.document.getElementsByTagName("a")[0]!=undefined)
				&& ($(".top1 .notice .tab-bd .tab-pal:eq(0) ul a:eq(6)")[0]!=undefined) ){
			clearInterval(_EsdDynamicTransformationScript.iframeInterval);
			
			
	_EsdDynamicTransformationScript.esd5TagNum1.focus(function (e) {
		$(this).bind("keydown.keydown_5", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				//轮播之后的焦点
				_EsdDynamicTransformationScript.esdTagCircleNum5.click();
				_EsdDynamicTransformationScript.esdTagANum5.focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd5TagNum1Content1.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd5TagNum1.blur(function () {
		$(this).unbind("keydown.keydown_5");
	});

	_EsdDynamicTransformationScript.esd5TagNum1Content1.focus(function () {
		$(this).bind("keydown.keydown_s5", function (e) {
			if (e.shiftKey && e.keyCode == 9) {
				_EsdDynamicTransformationScript.esd5TagNum1.focus();
				return false;
			}else if (e.keyCode == 9) {
				
			}
		});
	});
	_EsdDynamicTransformationScript.esd5TagNum1Content1.blur(function () {
		$(this).unbind("keydown.keydown_s5");
	});
	
	_EsdDynamicTransformationScript.esd5TagNum1ContentN.focus(function () {
		$(this).bind("keydown.keydown_e5", function (e) {
			if(e.shiftKey&&e.keyCode==9){
				$(".top1 .notice .tab-bd .tab-pal:eq(0) ul a:eq(5)").focus();
				return false;
			}else if (e.keyCode == 9) {
				_EsdDynamicTransformationScript.iframeTab1.focus();
				return false;
			}
		});
	});
	_EsdDynamicTransformationScript.esd5TagNum1ContentN.blur(function () {
		$(this).unbind("keydown.keydown_e5");
	});


				
	//通过方法赋值   
	_EsdDynamicTransformationScript.getIframeInfos(_EsdDynamicTransformationScript.iframe1,_EsdDynamicTransformationScript.iframeElement1);  
	_EsdDynamicTransformationScript.getIframeInfos(_EsdDynamicTransformationScript.iframe2,_EsdDynamicTransformationScript.iframeElement2); 

		
				
		//第一个标签 切换
		_EsdDynamicTransformationScript.iframeTab1.focus(function (e) {
			e = $(this).mouseover();
			$(this).bind("keydown.iframeKeydown_1", function (e) {
				if (e.shiftKey && e.keyCode == 9) {
					_EsdDynamicTransformationScript.esd5TagNum1.mouseover();
					_EsdDynamicTransformationScript.esd5TagNum1ContentN.focus();
					return false;
				} else if (e.keyCode == 9) {
					$(_EsdDynamicTransformationScript.iframe1.self).focus();
					return false;
				}
			});
		});
		_EsdDynamicTransformationScript.iframeTab1.blur(function () {
			$(this).unbind("keydown.iframeKeydown_1");
		});

		// 第一个标签的第一个链接
		$(_EsdDynamicTransformationScript.iframe1.first_aLink).focus(function () {
			$(this).bind("keydown.iframeKeydown_first1", function (e) {
				if (e.shiftKey && e.keyCode == 9) {
					_EsdDynamicTransformationScript.iframeTab1.focus();
					return false;
				} else if (e.keyCode == 9) {
					
				}
			});
		});
		$(_EsdDynamicTransformationScript.iframe1.first_aLink).blur(function () {
			$(this).unbind("keydown.iframeKeydown_first1");
		});

		// 第一个标签的最后一个链接
		$(_EsdDynamicTransformationScript.iframe1.last_aLink).focus(function () {
			$(this).bind("keydown.iframeKeydown_first1", function (e) {
				if (e.shiftKey && e.keyCode == 9) {
					
				} else if (e.keyCode == 9) {
					_EsdDynamicTransformationScript.iframeTab2.mouseover();
					_EsdDynamicTransformationScript.iframeTab2.focus();
					return false;
				}
			});
		});
		$(_EsdDynamicTransformationScript.iframe1.last_aLink).blur(function () {
			$(this).unbind("keydown.iframeKeydown_first1");
		});

		//第二个标签切换
		_EsdDynamicTransformationScript.iframeTab2.focus(function (e) {
			$(this).bind("keydown.iframeKeydown_2", function (e) {
				if (e.shiftKey && e.keyCode == 9) {
					_EsdDynamicTransformationScript.iframeTab1.mouseover();
					$(_EsdDynamicTransformationScript.iframe1.last_aLink).focus();
					return false;
				} else if (e.keyCode == 9) {
					$(_EsdDynamicTransformationScript.iframe2.self).focus();
					return false;
				}
			});
		});
		_EsdDynamicTransformationScript.iframeTab2.blur(function () {
			$(this).unbind("keydown.iframeKeydown_2");
		});

		
		}
	}, 500);

}
		
		




//首页结束
}


